<template>
  <div class="ne">
    <div>
      <div class="news-header">
        <el-button
            text
            class="left"
        >
          通知活动
        </el-button>
        <el-button
            :type = 'type1'
            text
            link
            class="right"
            @click="enter"
        >
          查看更多
        </el-button>
      </div>
    </div>
    <div class="news-bottom" >
      <el-table :data="data" style="width: 100%" :show-header=false >
        <el-table-column  prop="noticeTitle" :min-width="80" />
        <el-table-column  prop="createTime" :min-width="20" />
      </el-table>
    </div>
  </div>

</template>
<script lang="ts" setup >
import { homeListApi,homeListnot } from "../../api/index/index";
import { ref,onMounted } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const type1 = 'primary'
const data = ref([]);
onMounted(()=>{
  // home()
})
const home  = async () => { // 函解构用async和await包裹
  let params = {
    pageNum: 1,  //
    pageSize: 10,
    noticeType:'1'  // （1通知公告 2新闻动态 3正常文件）
  }
  const {rows,code} = await homeListnot(params)
  // 对data进行解构赋值 取出请求的结果res
  if(code==200){
    data.value = rows
    console.log(data)
  }else{
    console.log(code)
  }// 控制台打印结果 => 请求成功 code为200
}
function enter(){
  router.push({path:'/information/inform'})
}
</script>
<style>
.ne{
  margin-top: 20px;
  width:100%;
  padding: 20px;
}
.news-bottom{
  width:100%;
  height: 204px;
}
.news-header{
  width:100% ;
  display: flex;
  font-size: 20px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.left{
  float: left;
}
.right{
  float: right;
}
</style>